Windows 注意事項
Windows 10 Home
最好能升級到 Windows 10 專業版,如果必須使用 Windows 10 Home,請參考以下作法:
- Docker for Windows 不支持 Windows 10 Home(因為 Home edition 沒有 Hyper-V 功能),替代方案是安裝 Docker Toolbox
- Docker Toolbox 預設只能使用 C:/Users,要存取其他目錄需要另外設定
- Windows 10 Home 預設不支援 symbolic link,解決方法 -- 啟用開發人員模式
- 因為 Docker Toolbox 使用 VirtualBox,所以必須在 Oracle VM VirtualBox 中設定 8080 和 8000 的 port forwarding,才能正常執行 local server
WSL (Windows Subsystem for Linux)
如果使用 Windows 10 內建的 Ubuntu Bash,請注意:
- Linux 和 Windows 對於 symbolic link 的作法不同,請透過 git for Windows(而不要用 Linux 的 git) 取得 source,同時在 .gitconfig 中將 symlinks 設成 true,這樣取得的 source code 中如果含有 symbolic link 才被能正常存取
- Linux 可以透過 /mnt/c 存取 Windows 檔案系統,但不要從 Windows 去存取 Linux 的檔案系統
Cannot detect file change
目前的 Docker for Windows 無法自動偵測 shared drive 的檔案更改,導致修改某個 python 檔案時需要手動重啟 local server。
解決方法可參考 此範例